<template>
  <div id="app">
    <router-view @deflogout="logout"></router-view>
  </div>
</template>

<script>
  export default {
    name: 'App',
    data () {
      return {
        section: 'Head'
      }
    },
    computed: {
      def () {
        return {
          logout: ''
        }
      }
    },
    methods: {
      logout () {
        this.$store.commit('SET_USER', null)
        this.$store.commit('SET_TOKEN', null)

        if (window.localStorage) {
        // window.localStorage.setItem('user', null)
        // window.localStorage.setItem('token', null)
          window.localStorage.removeItem('user')
          window.localStorage.removeItem('token')
        }

        this.$router.push('/login')
      }
    }
  }
</script>
